# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Guillaume Horel <guillaume.horel@gmail.com>

pkgname=python-psycopg
pkgver=3.1.8
pkgrel=2
pkgdesc='PostgreSQL database adapter for Python'
arch=('any')
url='https://www.psycopg.org/psycopg3/'
license=('LGPL3')
depends=('python' 'postgresql-libs')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=('python-pytest' 'python-pytest-asyncio')
_commit='1ec7ed57f3c13a7bce3b817168325b30dbc35e6b'
source=("$pkgname::git+https://github.com/psycopg/psycopg.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build(){
  cd "$pkgname/psycopg"

  python -m build --wheel --no-isolation
}

package(){
  cd "$pkgname/psycopg"

  python -m installer --destdir="$pkgdir" dist/*.whl 
}
